<template>
    <div class="app-home">
        <router-view />
        <van-tabbar route>
            <van-tabbar-item replace to="/main" icon="user-o">首页</van-tabbar-item>
            <van-tabbar-item replace to="/setting" icon="setting-o">推送</van-tabbar-item>
            <!-- @click="handleInvite" -->
            <van-tabbar-item replace icon="home-o" to="/invite">邀请</van-tabbar-item>
            <van-tabbar-item replace to="/me" icon="user-o">我的</van-tabbar-item>
        </van-tabbar>
        
        <!-- <van-tabbar-item replace to="/community" icon="comment-circle-o">{{ $t('tab.tabCommunity') }}</van-tabbar-item>
        <van-tabbar-item replace to="/wallet" icon="balance-o">{{ $t('tab.tabWallet') }}</van-tabbar-item> -->
    </div>
</template>

<script>
import { showToast } from 'vant';
import { getAllstrategy } from '@/api/strategy';
import { getMyInfo } from '@/api/home'
import { useUserStore } from '@/store/user';
import { mapActions } from 'pinia';
export default {
    name: 'App',
    data() {
        return {
        }
    },
    created() {
        this.init();
    },
    methods: {
        ...mapActions(useUserStore, ['setStrategyList', 'setUserInfo', 'setWxConfig']),
        init() {
            // 存储策略列表
            getAllstrategy({}).then(res => {
                if (res.code === 20000) {
                    this.setStrategyList(res.data);
                }
            });
            // 存储用户信息
            getMyInfo().then(res => {
                if (res.code === 20000) {
                    this.setUserInfo(res.data);
                }
            })
            // this.setWxConfig();
        },
        handleInvite() {
            showToast('功能开发中，敬请期待')
        }
    }
}
</script>
<style></style>